array(
'method'=>"GET",
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents($remote_url, false, $context);
if (!$file) {
echo "ERROR";
exit;
}
$searchfor = 'Connection status';
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $file, $matches)){
$text = implode("\n", $matches[0]);
$output = substr($text, 25);
if (strpos($output, 'OK') !== false) {
$state = 'Connected : ';
} else {
$state = 'Ready for connection. Last User : ';
}
echo $state;
}
$searchfor = '(mac)';
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $file, $matches)){
$text = implode("\n", $matches[0]);
$output = substr($text, 24);
//echo "
";
//echo $output;
//echo "
";
if (strpos($output, '00:1e:fd:aa:bb:cc') !== false) {
$call = 'HB9EDI';
} elseif (strpos($output, '00:1e:fd:dd:ee:ff') !== false){
$call = 'HB9whatever';
}
else {$call = "Unknown Call from MAC address " . $output;}
echo $call;
}
?>